<%--
  User: Sujan
  Date: Mar 13, 2007
  Time: 2:26:18 PM
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>
<%@ taglib uri="/WEB-INF/struts-nested.tld" prefix="nested" %>
<%@ taglib uri="/WEB-INF/chiptrack-tags.tld" prefix="chiptrack" %>

<chiptrack:checkLogon sourcePage="/salesQuotations.do"/>

<%@ page import="com.scalar.chiptrack.users.Functionality,
                 com.scalar.chiptrack.users.User,
                 com.scalar.chiptrack.utils.ConfigManager"%>
<%@ page import="com.scalar.chiptrack.utils.StringUtils"%>
<%@ page import="com.scalar.chiptrack.commons.Constants"%>
<%
    String chipTracContext = "/" + ConfigManager.getChipTracContext();
%>
<HTML>
    <HEAD>
        <TITLE>Scalarsoft - Chip Trac</TITLE>
        <META http-equiv=Content-Type content="text/html; charset=windows-1252">
        <LINK href="<%=chipTracContext%>/jsp/includes/stylesheets/scalarsoft.css" type=text/css rel=stylesheet>
        <META content="MSHTML 5.50.4807.2300" name=GENERATOR>
        <script src="<%=chipTracContext%>/jsp/includes/scripts/functions.js"></script>
        <SCRIPT language="JavaScript" src="<%=chipTracContext%>/jsp/includes/scripts/validations.js"></script>
        <SCRIPT language="JavaScript">
            var newLineItemIdx = 0;
            var dateElement = "";
            function openCalendar(dateValue)
            {
                dateElement = dateValue;

                newWindow = window.open('<%=chipTracContext%>/jsp/includes/calendar.html','calenderPopup','channelmode=no,directories=no,toolbar=no,menubar=no,personalbar=no,status=no,scrollbars=no,width=180,height=440,resizable=no');
                newWindow.moveTo(550,180);
                newWindow.focus();
            }

            function assignDate(passedValue)
            {
                dateElement.value=passedValue;
                window.focus();
            }
            function submitPage(value)
            {
                if( value == 'SUBMIT' )
                {
                    if ( validateForm() )
                    {
                        document.splitQuotationForm.action="splitQuotation.do?action=submitSplitLineItems";
                        document.splitQuotationForm.submit();
                    }
                }
                else if ( value == 'CANCEL' )
                {
                    <%
                        if ( "true".equalsIgnoreCase( request.getParameter( "isReqFromTransferQuote") ) )
                        {
                    %>
                            document.splitQuotationForm.action="transferQuotation.do?action=EditSalesOrder";
                    <%
                        }
                        else
                        {
                    %>
                            document.splitQuotationForm.action="changeQuotation.do?action=EditQuotation";
                    <%
                        }
                    %>
                    document.splitQuotationForm.submit();
                }
                else if ( value == 'CONFIRM' )
                {
                    document.splitQuotationForm.action="splitQuotation.do?action=confirmSplitLineItems";
                    document.splitQuotationForm.submit();
                }
                else if ( value == 'EDIT' )
                {
                    document.splitQuotationForm.action="splitQuotation.do?action=editSplitLineItems";
                    document.splitQuotationForm.submit();
                }
            }
            function splitLineItem( lineItemIdx )
            {
                var form = document.splitQuotationForm;
                var splitLineItemsTable = document.getElementById( "splitLineItemsTable" );
                var splitRow = document.getElementById( "rowIdx" + lineItemIdx );
                var splitRowIdx = splitRow.rowIndex;
                var newRow = splitLineItemsTable.insertRow(splitRowIdx+1);
                newRow.bgColor = "#FFFFEE";
                newRow.id = "rowIdx" + newLineItemIdx;
                newRow.className = "NArialL";
                var cell = newRow.insertCell(); //LineITem NO
                    //cell.innerHTML = form["lineItems["+ lineItemIdx +"].lineItemNo"].value;
                cell = newRow.insertCell(); //PO LINE ITEM NO
                    cell.align = "center"
                    cell.innerHTML = form["lineItems["+ lineItemIdx +"].poLineItemNo"].value;
                cell = newRow.insertCell(); //PART NUMBER
                    cell.innerHTML = form["lineItems["+ lineItemIdx +"].manufacturingPartNo"].value;
                cell = newRow.insertCell(); //CUST PART NUMBER
                    cell.innerHTML = form["lineItems["+ lineItemIdx +"].customerPartNo"].value;
                cell = newRow.insertCell(); //DESC
                    cell.innerHTML = form["lineItems["+ lineItemIdx +"].description"].value;
                cell = newRow.insertCell(); //REQ. DOCK DATE
                    cell.noWrap = true;
                    cell.innerHTML = "<input type='text' name='lineItems["+ newLineItemIdx +"].requestDate' class='txfield' size=12 value='" + form["lineItems["+ lineItemIdx +"].requestDate"].value + "'>";
                    cell.innerHTML = cell.innerHTML + " &nbsp;<a href='javascript:openCalendar(document.splitQuotationForm[\"lineItems["+ newLineItemIdx +"].requestDate\"])'><img onMouseOver='window.status=\"Click here to select date\";return true'" + " border='0' align='center' src='<%=chipTracContext%>/jsp/includes/images/date_selector.gif' height=20 width=20></a>";
                cell = newRow.insertCell(); //QTY
                cell = newRow.insertCell(); //PRICE
                    cell.align = "right"
                    cell.innerHTML = form["lineItems["+ lineItemIdx +"].unitPriceAsDouble"].value;
                cell = newRow.insertCell(); //AMOUNT
                cell = newRow.insertCell(); //QTY AFTER SPLIT
                cell = newRow.insertCell(); //SPLIT QTY
                    cell.innerHTML = "<input type='text' name='lineItems["+ newLineItemIdx +"].splitQty' size='6' class='valuetxfield' onkeypress='javascript:allowInteger()' onkeyup='updateQty("+ newLineItemIdx +")'>";
                cell = newRow.insertCell(); //REMOVE LINK
                    cell.bgColor = "#FFFFFF";
                    cell.innerHTML = "<A href='javascript:removeLineItem("+newLineItemIdx+")'>Remove</A>";
                    var hiddenElementsHTML = "\n<input type='hidden' name='lineItems["+newLineItemIdx+"].lineItemId' value='0'>"
                       hiddenElementsHTML += "\n<input type='hidden' name='lineItems["+newLineItemIdx+"].lineItemNo' value='0'>"
                       hiddenElementsHTML += "\n<input type='hidden' name='lineItems["+newLineItemIdx+"].poLineItemNo' value='"+ form["lineItems["+ lineItemIdx +"].poLineItemNo"].value +"'>"
                       hiddenElementsHTML += "\n<input type='hidden' name='lineItems["+newLineItemIdx+"].manufacturingPartNo' value='"+ form["lineItems["+ lineItemIdx +"].manufacturingPartNo"].value +"'>"
                       hiddenElementsHTML += "\n<input type='hidden' name='lineItems["+newLineItemIdx+"].customerPartNo' value='"+ form["lineItems["+ lineItemIdx +"].customerPartNo"].value +"'>"
                       hiddenElementsHTML += "\n<input type='hidden' name='lineItems["+newLineItemIdx+"].description' value='"+ form["lineItems["+ lineItemIdx +"].description"].value +"'>"
                       hiddenElementsHTML += "\n<input type='hidden' name='lineItems["+newLineItemIdx+"].unitPriceAsDouble' value='"+ form["lineItems["+ lineItemIdx +"].unitPriceAsDouble"].value +"'>"
                       hiddenElementsHTML += "\n<input type='hidden' name='lineItems["+newLineItemIdx+"].split' value='true'>"
                       hiddenElementsHTML += "\n<input type='hidden' name='lineItems["+newLineItemIdx+"].splitFromLineItemId' value='"+ form["lineItems["+ lineItemIdx +"].lineItemId"].value +"'>"
                    cell.innerHTML += hiddenElementsHTML;

                newLineItemIdx = newLineItemIdx+1;
            }
            function removeLineItem( lineItemIdx )
            {
                var form = document.splitQuotationForm;
                form['lineItems['+ lineItemIdx +'].splitQty'].value = 0
                updateQty( lineItemIdx )
                var splitRow = document.getElementById( "rowIdx" + lineItemIdx );
	            splitRow.parentNode.removeChild(splitRow);

            }
            function updateQty ( childLineItemIdx )
            {
                var form = document.splitQuotationForm;
                var pa = document.getElementById( "error" );
                pa.innerHTML = "";
                var parentLineItemIdx = getParentLineItemIdx(childLineItemIdx)
                var totalSplitQty = getChildsTotalSplitQty(parentLineItemIdx)
                var parentQty =  form['lineItems['+ parentLineItemIdx +'].quantity'].value;
                var qtyAfterSplit = parentQty - totalSplitQty;
                if ( qtyAfterSplit <= 0 )
                {
                    //ERROR
                    form['lineItems['+ childLineItemIdx +'].splitQty'].value = ''
                    updateQty(childLineItemIdx);//RECALCULATE THE QTY AFTER SPLIT
                    pa.innerHTML = "<li>Total Split Qty should be less than parent line item quantity</li>"
                }
                else
                {
                    form['lineItems['+ parentLineItemIdx +'].qtyAfterSplit'].value = qtyAfterSplit;
                }

            }
            function getParentLineItemIdx ( childLineItemIdx )
            {
                var form = document.splitQuotationForm;
                var childSplitLineItemId = form['lineItems['+ childLineItemIdx +'].splitFromLineItemId'].value;
                for ( k=0; k < newLineItemIdx; k++ )
                {
                    if ( form['lineItems['+ k +'].lineItemId'] != null || typeof form['lineItems['+ k +'].lineItemId'] != 'undefined' )
                    {
                        var parentLineItemId = form['lineItems['+ k +'].lineItemId'].value;
                        if ( parentLineItemId > 0 && parentLineItemId == childSplitLineItemId )
                        {
                            return k;
                        }
                    }
                }
                return -1;
            }
            function getChildsTotalSplitQty ( parentLineItemIdx )
            {
                var form = document.splitQuotationForm;
                var parentLineItemId = form['lineItems['+ parentLineItemIdx +'].lineItemId'].value;
                var totalSplitQty = 0;
                for ( k=0; k < newLineItemIdx; k++ )
                {
                    if ( form['lineItems['+ k +'].lineItemId'] != null || typeof form['lineItems['+ k +'].lineItemId'] != 'undefined' )
                    {
                        var childLineItemId = eval(form['lineItems['+ k +'].lineItemId'].value)
                        var childSplitLineItemId = eval(form['lineItems['+ k +'].splitFromLineItemId'].value)
                        if ( childLineItemId <= 0 && parentLineItemId == childSplitLineItemId )
                        {
                            var splitQty = form['lineItems['+ k +'].splitQty'].value;
                            splitQty = parseInt(splitQty,10) > 0 ? parseInt(splitQty,10) : 0;
                            totalSplitQty += splitQty;
                        }
                    }
                }
                return totalSplitQty;
            }
            function validateForm()
            {
                var pa = document.getElementById( "error" );
                pa.innerHTML = "";
                var errors = "";
                var form = document.splitQuotationForm;
                var isSplitLineItemPresent = false;
                for ( k=0; k < newLineItemIdx; k++ )
                {
                    if ( form['lineItems['+ k +'].lineItemId'] != null || typeof form['lineItems['+ k +'].lineItemId'] != 'undefined' )
                    {
                        var lineItemId = eval(form['lineItems['+ k +'].lineItemId'].value)
                        if ( lineItemId <= 0 ) //child line item
                        {
                            isSplitLineItemPresent = true;
                            var reqDate = form['lineItems['+ k +'].requestDate'];
                            if( chkDate(reqDate.value,"Requested Dock Date","Y") == false)
                            {
                                errors += errMsg;
                                reqDate.select();
                                reqDate.focus();
                            }
                            var splitQty = form['lineItems['+ k +'].splitQty'].value;
                            splitQty = parseInt(splitQty,10) > 0 ? parseInt(splitQty,10) : 0;
                            if ( splitQty <= 0 ) //SPLIT QTY SHOULD BE GREATER THAN ZERO
                            {
                                errors += "<li>Please enter Split Qty greater than Zero or Remove the line item</li>"
                                form['lineItems['+ k +'].splitQty'].select()
                                form['lineItems['+ k +'].splitQty'].focus()
                            }
                            if( errors != "" )
                            {
                                pa.innerHTML = errors;
                                return false;
                            }
                        }
                    }
                }
                if ( isSplitLineItemPresent == false )
                {
                    pa.innerHTML = "<li>Please Split atleast one line item</li>"
                    return false;
                }
                return true;
            }
        </SCRIPT>
    </HEAD>
    <BODY bgColor="#ffffff" leftMargin=0 topMargin=0 marginheight="0" marginwidth="0"  >
    <%
        String userTypeChiptrac = Constants.USER_TYPE_CHIPTRAC + "";
    %>
    <logic:equal value="<%=userTypeChiptrac%>" name="user" property="userType" scope="session">
        <%@ include file="/jsp/includes/header.jsp" %>
    </logic:equal>
    <logic:notEqual value="<%=userTypeChiptrac%>" name="user" property="userType" scope="session">
        <%@ include file="/jsp/includes/extHeader.jsp" %>
    </logic:notEqual>
    <TABLE cellSpacing=0 cellPadding=0 width="100%" border=0>
    <TBODY>
        <TR>
	        <td width='180' valign='top' background='<%=chipTracContext%>/jsp/includes/images/left_red_bg.gif'>
            <!-- Side Navigation start -->
                <logic:equal value="<%=userTypeChiptrac%>" name="user" property="userType" scope="session">
                    <%@ include file="/jsp/sales/sales_order_menu.jsp" %>
                </logic:equal>
                <logic:notEqual value="<%=userTypeChiptrac%>" name="user" property="userType" scope="session">
                    <%@ include file="/jsp/sales/ext_sales_order_menu.jsp" %>
                </logic:notEqual>
            <!-- end of the side navigations -->
            </TD>
            <TD bgcolor="#ffffff">
                <IMG height=9 src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" width=8></TD>
            <TD bgcolor="#ffffff"><IMG height=480 src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" width=2></TD>
            <TD valign="top" width="100%">
                <IMG height=1 src="<%=chipTracContext%>/jsp/includes/images/clear.gif" width=500 border=0>
                <!-- from here your body starts -->
                <img src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" height=10>
                <html:form name="splitQuotationForm" action="/splitQuotation.do" method="post" type="com.scalar.chiptrack.sales.forms.quote.SplitQuotationForm">
                <table border="0" width="100%" align=right >
                    <tr><td colspan=6> <center><span class="NArialW">Split Quotation</span></center></td></tr>
                    <tr><td height=20 colspan=6>
                        <chiptrack:info styleClass="NArialL" />
                        <chiptrack:errors styleClass="NArialL" />
                        </td>
                    </tr>
                    <tr><td colspan='6' align="left" class='NArialL'><FONT id="error" color='red'></FONT><br></TD></tr>
                    <tr><td colspan=6 align="center" class="NArialL">Quotation #  <nested:write property="quotationNo" /></td></tr>
                    <nested:hidden property="quotationNo" />
                    <nested:hidden property="quotationId" />
                    <nested:hidden property="isReqFromTransferQuote" />
                    <nested:hidden property="customerId" />
                    <tr>
                        <td colspan=6>
                            <table border="0" width="100%" bordercolor="#FFFFFF" id="splitLineItemsTable">
                                <tr>
                                    <td width="8%" align="center" bgcolor="#993333" class="NArialL"><font color="#FFFFFF">Line Item</font></td>
                                    <td width="8%" align="center" bgcolor="#993333" class="NArialL"><font color="#FFFFFF">PO Line Item</font></td>
                                    <td width="15%" align="center" bgcolor="#993333" class="NArialL"><font color="#FFFFFF"><bean:message key="label.mfgPartNumber" /></font></td>
                                    <td width="15%" align="center" bgcolor="#993333" class="NArialL"><font color="#FFFFFF"><bean:message key="label.customerPartNumber"/></font></td>
                                    <td width="15%" align="center" bgcolor="#993333" class="NArialL"><font color="#FFFFFF">Description</font></td>
                                    <td width="15%" align="center" bgcolor="#993333" class="NArialL"><font color="#FFFFFF">Req'd Dock Date<br>(mm/dd/yyyy)</font></td>
                                    <td width="5%" align="center" bgcolor="#993333" class="NArialL"><font color="#FFFFFF">Quantity</font></td>
                                    <td width="10%" align="center" bgcolor="#993333" class="NArialL"><font color="#FFFFFF">Price </font></td>
                                    <td width="15%" align="center" bgcolor="#993333" class="NArialL"><font color="#FFFFFF">Amount</font></td>
                                    <logic:notEqual value="true" name="isConfirm" scope="request">
                                    <td width="100" align="center" bgcolor="#993333" class="NArialL"><font color="#FFFFFF">Qty After Split</font></td>
                                    <td width="15%" align="center" bgcolor="#993333" class="NArialL"><font color="#FFFFFF">Split Quantity</font></td>
                                    <td width="15%" align="center" class="NArialL"><!--<font color="#FFFFFF">Split</font>--></td>
                                    </logic:notEqual>
                                </tr>
                            <nested:iterate id="lineItem" indexId="idx" property="lineItems" type="com.scalar.chiptrack.sales.LineItem">
                                <logic:notEqual value="true" name="isConfirm" scope="request">
                                <tr bgcolor='<%=lineItem.getLineItemId() > 0 ? "#DEE1E2" : "#FFFFEE"%>' id="rowIdx<%=idx.intValue()%>">
                                    <td class="NArialL" align="center">
                                        <nested:greaterThan value="0" property="lineItemId">
                                            <nested:write property="lineItemNo"/>
                                        </nested:greaterThan>
                                    </td>
                                    <td class="NArialL" align="center"><nested:write property="poLineItemNo" /></td>
                                    <td class="NArialL"><nested:write property="manufacturingPartNo" /></td>
                                    <td class="NArialL"><nested:write property="customerPartNo" /></td>
                                    <td class="NArialL"><nested:write property="description" /></td>
                                    <td class="NArialL" nowrap>

                                        <nested:greaterThan value="0" property="lineItemId">
                                            <nested:write property="requestDate" />
                                            <nested:hidden property="requestDate" />
                                        </nested:greaterThan>
                                        <nested:lessEqual value="0" property="lineItemId">
                                            <nested:text property="requestDate" styleClass="txfield" size="12"/>&nbsp;&nbsp;<a href="javascript:openCalendar(document.splitQuotationForm['lineItems[<%=idx.intValue()%>].requestDate'])"><img onMouseOver='window.status="Click here to select date";return true' border='0' align='middle' src='<%=chipTracContext%>/jsp/includes/images/date_selector.gif' height=20 width=20></a>
                                        </nested:lessEqual>
                                    </td>
                                    <td class="NArialL" align="right">
                                        <nested:greaterThan value="0" property="lineItemId">
                                            <nested:write property="quantity"/>
                                        </nested:greaterThan>
                                    </td>
                                    <td class="NArialL" align="right"><nested:write property="unitPriceAsDouble" /></td>
                                    <td class="NArialL" align="right">
                                        <nested:greaterThan value="0" property="lineItemId">
                                            <nested:write property="amountAsString"/>
                                        </nested:greaterThan>
                                    </td>
                                    <td class="NArialL">
                                        <nested:greaterThan value="0" property="lineItemId">
                                            <nested:text property="qtyAfterSplit" styleClass="valuetxfield" size="6" readonly="true"/>
                                        </nested:greaterThan>
                                    </td>
                                    <td class="NArialL">
                                        <nested:lessEqual value="0" property="lineItemId">
                                            <%
                                                String onKeyUp = "updateQty(" + idx.intValue() + ")";
                                            %>
                                            <nested:text property="splitQty" size="6" styleClass="valuetxfield" onkeypress="javascript:allowInteger()" onkeyup="<%=onKeyUp%>"/>
                                        </nested:lessEqual>
                                    </td>
                                    <td class="NArialL" bgcolor="#FFFFFF">
                                        <nested:greaterThan value="0" property="lineItemId">
                                            <a href="javascript:splitLineItem(<%=idx.intValue()%>)">Split</a>
                                        </nested:greaterThan>
                                        <nested:lessEqual value="0" property="lineItemId">
                                            <a href="javascript:removeLineItem(<%=idx.intValue()%>)">Remove</a>
                                        </nested:lessEqual>
                                    </td>
                                        <nested:hidden property="lineItemId" />
                                        <nested:hidden property="lineItemNo" />
                                        <nested:hidden property="poLineItemNo" />
                                        <nested:hidden property="manufacturingPartNo" />
                                        <nested:hidden property="customerPartNo" />
                                        <nested:hidden property="description" />
                                        <nested:hidden property="quantity" />
                                        <nested:hidden property="unitPriceAsDouble" />
                                        <nested:hidden property="amountAsDouble" />
                                        <nested:hidden property="split" />
                                        <nested:hidden property="splitFromLineItemId" />
                                </tr>
                                </logic:notEqual>
                                <logic:equal value="true" name="isConfirm" scope="request">
                                <tr bgcolor='<%=lineItem.getLineItemId() > 0 ? "#DEE1E2" : "#FFFFEE"%>' id="rowIdx<%=idx.intValue()%>">
                                    <td class="NArialL" align="center">
                                        <nested:greaterThan value="0" property="lineItemId">
                                            <nested:write property="lineItemNo"/>
                                        </nested:greaterThan>
                                    </td>
                                    <td class="NArialL" align="center"><nested:write property="poLineItemNo" /></td>
                                    <td class="NArialL"><nested:write property="manufacturingPartNo" /></td>
                                    <td class="NArialL"><nested:write property="customerPartNo" /></td>
                                    <td class="NArialL"><nested:write property="description" /></td>
                                    <td class="NArialL"><nested:write property="requestDate" /></td>
                                    <td class="NArialL" align="right">
                                        <nested:greaterThan value="0" property="lineItemId">
                                            <nested:write property="qtyAfterSplit"/>
                                        </nested:greaterThan>
                                        <nested:lessEqual value="0" property="lineItemId">
                                            <nested:write property="splitQty"/>
                                        </nested:lessEqual>
                                    </td>
                                    <td class="NArialL" align="right"><nested:write property="unitPriceAsDouble" /></td>
                                    <td class="NArialL" align="right">
                                        <%
                                            double amountAsDouble = 0d;
                                            if ( lineItem.getLineItemId() > 0 )
                                            {
                                                amountAsDouble = lineItem.getQtyAfterSplit() * lineItem.getUnitPriceAsDouble();
                                            }
                                            else
                                            {
                                                amountAsDouble = lineItem.getSplitQty() * lineItem.getUnitPriceAsDouble();
                                            }
                                            out.println ( StringUtils.formatAmountWithNoOfDecimals( amountAsDouble ) );
                                        %>
                                    </td>
                                        <nested:hidden property="lineItemId" />
                                        <nested:hidden property="lineItemNo" />
                                        <nested:hidden property="poLineItemNo" />
                                        <nested:hidden property="manufacturingPartNo" />
                                        <nested:hidden property="customerPartNo" />
                                        <nested:hidden property="description" />
                                        <nested:hidden property="requestDate" />
                                        <nested:hidden property="quantity" />
                                        <nested:hidden property="unitPriceAsDouble" />
                                        <nested:hidden property="amountAsDouble" />
                                        <nested:hidden property="split" />
                                        <nested:hidden property="splitFromLineItemId" />
                                        <nested:hidden property="qtyAfterSplit" />
                                        <nested:hidden property="splitQty" />
                                </tr>
                                </logic:equal>
                                </nested:iterate>
                                <nested:size id="lineItemsSize" property="lineItems"/>
                                <SCRIPT>
                                    newLineItemIdx = <%=lineItemsSize.intValue()%>
                                </SCRIPT>
                                <logic:equal value="0" name="lineItemsSize">
                                <tr>
                                    <td colspan="14"><font class="NArialL" style="color:red">&nbsp;&nbsp;No Line items available for Splitting</font></td>
                                </tr>
                                </logic:equal>
                                <logic:equal value="true" name="isConfirm" scope="request">
                                <tr>
                                    <td valign=top colspan=2 class="NArialL"><font color="red"><u>Warning:</u></font></td>
                                    <td colspan=7 class="NArialL"><font color="red">Please note that if you confirm to split the line items, you can't merge it back to previous stage. So, please check before confirming.</font></td>
                                </tr>
                                </logic:equal>
                            </table>
                        </td>
                    </tr>
                    <tr>
                        <td>&nbsp;</td>
                    </tr>
                    <tr>
                        <td colspan=6 align=center>
                            <logic:notEqual value="true" name="isConfirm" scope="request">
                                <chiptrack:restrictedLink functionality='<%=Functionality.SALES_NEW_QUOTATION%>' action='<%=User.USER_ACTION_MODIFY%>' href="javascript:submitPage('SUBMIT');" onmouseover="window.status='Click here to save sales order';return true" onmouseout="window.status='';return true">
                                    <img src="<%=chipTracContext%>/jsp/includes/images/submit.gif" border='0'></chiptrack:restrictedLink>
                                &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                                <a href="javascript:document.splitQuotationForm.reset();"><img src='<%=chipTracContext%>/jsp/includes/images/reset.gif' border=0></a>
                                &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                                <a href="javascript:submitPage('CANCEL');"><img src='<%=chipTracContext%>/jsp/includes/images/cancel.gif' border=0></a>
                            </logic:notEqual>
                            <logic:equal value="true" name="isConfirm" scope="request">
                                <chiptrack:restrictedLink functionality='<%=Functionality.SALES_NEW_QUOTATION%>' action='<%=User.USER_ACTION_MODIFY%>' href="javascript:submitPage('CONFIRM');" onmouseover="window.status='Click here to save sales order';return true" onmouseout="window.status='';return true">
                                    <img src="<%=chipTracContext%>/jsp/includes/images/confirm.gif" border='0'></chiptrack:restrictedLink>
                                &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                                <chiptrack:restrictedLink functionality='<%=Functionality.SALES_NEW_QUOTATION%>' action='<%=User.USER_ACTION_MODIFY%>' href="javascript:submitPage('EDIT');" onmouseover="window.status='Click here to save sales order';return true" onmouseout="window.status='';return true">
                                    <img src='<%=chipTracContext%>/jsp/includes/images/edit.gif' border=0></chiptrack:restrictedLink>
                            </logic:equal>
                        </td>
                    </tr>
                </table>
                </html:form>
            <!-- till here -->
            <BR><BR><BR>
            </TD>
            <TD bgcolor="#ffffff"><IMG height=1 src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" width=1></TD>
        </TR>
    </TBODY>
    </TABLE>
    <!-- Footer starts here -->
    <%@ include file="/jsp/includes/footer.jsp" %>
    <!-- footer end here -->
    </BODY>
</HTML>